<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>米行域名批量交易平台</title>
		<include file="./Public/mob/public/public.html" />
		<style>
			.mousactive {
				background-color: #FF6524;
				color: #fff;
			}
		</style>
		<link href="{$app_path}{$static_path}/css/css.css" rel="stylesheet" type="text/css" />

		<script type="text/javascript" language="javascript" src="{$app_path}{$static_path}/mob/js/16sucai.js"></script>

	</head>

	<body>
		<include file="./Public/public/top.html" />
		<script>
			$(document).ready(function() {
				//滚动条
				$(".slimscroll").slimScroll({
					height: '100%',
					opacity: 0.3
				});
				//取消订单
				var isCancelling = false;
				$("a[action='cancel_orderdd']").click(function() {
					var partrid = 'trdomain' + $(this).attr('data-id');
					if(isCancelling) {
						showModal({
							msg: '操作正在进行，请稍候'
						});
						return;
					}
					var _this = $(this);
					var _id = $(_this).attr('data-id');
					if(!_id) return;
					showConfirm({
						msg: "您确定要取消该订单吗?",
						confirmed: function() {
							isCancelling = true;
							$.ajax({
								url: "{:U('UserEntrust/cancelTradeAgent')}",
								type: "POST",
								data: {
									id: _id
								},
								success: function(resp) {
									isCancelling = false;
									if(resp.status != 1) {
										showModal({
											msg: resp.msg
										});
									} else {
										$("#" + partrid).remove();
									}
								}
							}).fail(function() {
								isCancelling = false;
							});
						}
					})
				});

				// 交易大厅品类下拉列表
				$('li[action="menu"]').mouseenter(function() {
					$(this).find("ul").fadeIn(500);
				}).mouseleave(function() {
					$(this).find("ul").fadeOut(500);
				});

			});
		</script>
		<style>
			input:disabled {
				border: 1px solid #DDD;
				background-color: #F5F5F5;
				color: #ACA899;
			}
		</style>
		<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/mob/css/trade.css">
		<div class="layout-wrap ">
			<div class="layout market" style="">
				<div class="market-menu-group  pc-only" style="height: 583px;border-bottom: 1px solid #eee;">

					<div id="firstpane" class="menu_list">
						<p class="menu_head" style="padding-left: 72px;padding-top: 41px;padding-bottom: 40px;font-size: 15px;     border-bottom: solid 1px #eeeeee;">{$categoryobj['name']}</p>
						<div class="menu_body">
							<div class="slimscroll" style="overflow: hidden; width: auto; height: 100%;">
								<volist name="categoryArr" id="vo">
									<if condition="$vo.id eq $categoryId">
										<a class="menu active" href="{:U('Index/index',array('category'=>$vo['id']))}">{$vo.name}</a>
										<else />
										<a class="menu" href="{:U('Index/index',array('category'=>$vo['id']))}">{$vo.name}</a>
									</if>
								</volist>

							</div>
						</div>
					</div>

					<div class="t1bg" style="width:93%;margin-left: 9px;height: 452px;">
						<table class="table t1" style="width: 100.3%;margin-top: -1px;">
							<tbody>
								<div class="table" id="plate_container" style="margin-top: 12px;">
									<div class="th">
										<div class="td w20" style="margin-left: 30px;"><span>授信</span></div>
										<div class="td w30" style="margin-left: 15px;"><span>利率</span></div>
										<div class="td w20" style="margin-left: 15px;"><span>总额</span></div>
										<div class="clr"></div>
									</div>
								</div>
								<volist name="joke" id="vo">
									<tr class="up ng-scope" style="text-align:center; height: 37px;">
										<td class="text-left pl ng-binding">
											{$vo.credit}
										</td>
										<td class="text-right ng-binding">
											{$vo.rate}%
										</td>
										<td class="text-right pr ng-binding">
											111111111元
										</td>
									</tr>
								</volist>
							</tbody>
						</table>
					</div>
				</div>
				<!--
            <div class="market-menu-group mobile-only">
            </div>-->
				<div class="market-content">
					<div class="number-group">
						<div class="first-item green06 pc-only" id="current_price">
							<span class="red06" style="font-size: inherit;">￥{$nowTopriceArr}</span>
							<span class="ml10 red06" style="font-size: inherit;"><if condition="$nowRange eq 1">↓<else />↑</if></span>
						</div>
						<div class="item">
							<div class="number green06" id="highestPrice">￥{$priceHigh}</div>
							<div class="remark">单个最高价</div>
						</div>
						<div class="item">
							<div class="number red06" id="lowestPrice">￥{$priceLow}</div>
							<div class="remark">单个最低价</div>
						</div>
						<div class="item">
							<div class="number" id="volume">{$domainLjNumber}</div>
							<div class="remark">成交量</div>
						</div>
						<div class="item">
							<div class="number" id="transAmount">{$domainLjPrice}元</div>
							<div class="remark">成交总额</div>
						</div>
						<div class="item">
							<div class="number" id="loan_limit">￥{$credit_limit}</div>
							<div class="remark">今日授信额度</div>
						</div>
						<!-- <a class="item" href="http://auction.ename.com/tao/autobuy?autodomaingroup=26040&amp;autodomaintld=1" target="_blank">
                        <div class="number" id="e_name">￥11200.0</div>
                       <div class="remark">易名最新成交价</div>
                    </a> -->
						<div class="clr"></div>
					</div>
					<div class="chart-wrapper">
						<div class="chart" id="chart" _echarts_instance_="ec_1478848540081" style="-webkit-tap-highlight-color: transparent;
                          -webkit-user-select: none; position: relative; background-color: transparent;border: 1px solid red;">
							<div style="position: relative;overflow: hidden; width: 673px; height: 450px; cursor: default;">
                           	<canvas width="673" height="450" data-zr-dom-id="zr_0" style="position: absolute;left: 0px; top: 0px; width: 673px; height: 450px; -webkit-user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
                            </canvas>
                            </div>
							<div style="position: absolute; display: none; border: 0px solid rgb(51, 51, 51); white-space: nowrap; z-index: 9999999; transition: left 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                             top 0.4s cubic-bezier(0.23, 1, 0.32, 1); border-radius: 4px; color: rgb(255, 255, 255); font-style: normal; font-variant: normal; font-weight: normal; 
                             font-stretch: normal; font-size: 14px; font-family: &quot;Microsoft YaHei&quot;; line-height: 21px; padding: 5px; left: 184.019px; top: 314px; 
                             background-color: rgba(50, 50, 50, 0.701961);">2016-11-05 22:11:40<br>{$categoryobj['name']}<br>价格：{$nowTopriceArr}</div>
						</div>
						<div class="table-trade pc-only">
							<div class="table" id="plate_container">
								<div class="th">
									<div class="td w20"><span class="ml10">档位</span></div>
									<div class="td w30"><span class="ml10">单价</span></div>
									<div class="td w20"><span class="ml10">数量</span></div>
									<div class="td w30"><span class="ml10">总价</span></div>
									<div class="clr"></div>
								</div>
								<volist name="dangweiSellArr" id="vo">
									<div class="tr">
										<div class="td w20">
											<span class="ml10 green06">卖{$darray[$i-1]}</span>
										</div>
										<div class="td w30"><span class="ml10">￥{$vo.unit_price}</span></div>
										<div class="td w20"><span class="ml10">{$vo.surplus}个</span></div>
										<div class="td w30"><span class="ml10">￥{$vo['unit_price']*$vo['surplus']}</span></div>
										<div class="clr"></div>
									</div>
								</volist>
								<volist name="dangweiMallArr" id="vo">
									<div class="tr">
										<div class="td w20">
											<span class="ml10 red06">买{$i}</span>
										</div>
										<div class="td w30"><span class="ml10">￥{$vo.unit_price}</span></div>
										<div class="td w20"><span class="ml10">{$vo.surplus}个</span></div>
										<div class="td w30"><span class="ml10">￥{$vo['unit_price']*$vo['surplus']}</span></div>
										<div class="clr"></div>
									</div>
								</volist>
							</div>
						</div>
					</div>
					<!---->
					<div class="tab-group mobile-only">
						<a class="active">买入</a>
						<a>卖出</a>
						<div class="clr"></div>
					</div>
					<!---->
					<div class="trade-wrapper">
						<div class="swiper-container">
							<div class="swiper-wrapper">
								<!-------buy-------->
								<div class="swiper-slide">
									<form action="{:U('EntrustTra/agentbuyingp')}" method="post" id="frm_buying">
										<input type="hidden" value="{$categoryobj['id']}" name="category_id">
										<div class="trade-box active">
											<h3 class="red06">批量买入</h3>
											<div class="form-row form-row-s">
												<div class="input-name w25">买入域名</div>
												<div class="input-box w65"><b class="ddname">{$categoryobj['name']}</b></div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">购买方式</div>
												<div class="input-box w65">
													<select name="is_loan" id="buy_type">
														<option value="1">全款购买</option>
														<option value="2">抵押购买</option>
													</select>
												</div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">抵押周期</div>
												<div class="input-box w65">
													<select name="term" class="form-control" id="diya-term_period" disabled="true">
														<option value="">-借款天数-</option>
														<option value="7">7天</option>
														<option value="15">15天</option>
														<option value="30">1个月</option>
														<option value="60">2个月</option>
														<option value="90">3个月</option>
														<option value="120">4个月</option>
														<option value="150">5个月</option>
														<option value="180">6个月</option>
														<option value="210">7个月</option>
														<option value="240">8个月</option>
														<option value="270">9个月</option>
														<option value="300">10个月</option>
														<option value="330">11个月</option>
														<option value="360">12个月</option>
													</select>

												</div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">贷款产品</div>
												<div class="input-box w65">
													<select name="period" id="buy_type_period" disabled="true">
													</select>
												</div>
												<div class="clr"></div>
											</div>

											<div class="form-row form-row-s">
												<div class="input-name w25">买入单价</div>
												<div class="input-box w20">
													<input type="tel" class="input-s" data-type="b" id="buy_price" name="price" maxlength="7" placeholder="单价(元)" value="0" valid="{'required':true, 'number': true" msg="{'required':'请填写买入单价', 'number':'买入单价必须为数字'}">
												</div>
												<div class="input-name-even w50" id="buy_currency_formatter"></div>

												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">买入数量</div>
												<div class="input-box w20">
													<input type="tel" class="input-s" name="number" maxlength="3" data-type="b" id="buy_number" placeholder="数量(个)" value="1" valid="{'required':true, 'number': true}" msg="{'required':'请填写买入数量', 'number':'买入数量必须为数字'}">
												</div>
												<div class="input-name-even w50 red06" id="balance" data-balance="2.06">可用余额:{$avail_money}元</div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">有效时间</div>
												<div class="input-box w65">
													<select name="duration">
														<option value="0">一直有效</option>
														<option value="1">1天</option>
														<option value="3">3天</option>
														<option value="5">5天</option>
														<option value="10">10天</option>
													</select>
												</div>
												<div class="clr"></div>
											</div>

											<div class="form-row form-row-s">
												<div class="input-name w25">需支付</div>
												<div class="input-box w70" id="buy_total">
													0元(零元)

												</div>
												<div class="clr"></div>
											</div>
											<div class="split-dot text-center"></div>
											<div class="form-row form-row-s">
												<div class="input-name w25">交易密码</div>
												<div class="input-box w40">
													<input name="buyauthpwd" type="password" id="bypaswd" valid="{'required':true}" msg="{'required':'请填写交易密码'}" class="input-s" autocomplete="off">
												</div>
												<div class="input-name-even w30" <a href="/Home/Center/pwd.html">设置密码?</a>
												</div>
												<div class="clr"></div>
											</div>
											<div class="split-dot mb20 text-center"></div>
											<div class="form-row form-row-s">
												<input type="button" action="confirm_buying" class=" button button-orange w100 " value="买入">
												<div class="clr"></div>
											</div>
										</div>
									</form>
								</div>
								<div class="swiper-slide">
									<form action="{:U('EntrustTra/fetchtradable')}" method="post" id="frm_sellingid">
										<input type="hidden" value="{$categoryobj['id']}" name="category_id">
										<div class="trade-box left">
											<h3 class="green06">批量卖出</h3>
											<div class="form-row form-row-s">
												<div class="input-name w25">卖出域名</div>
												<div class="input-box w65"><b>{$categoryobj['name']}</b></div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">域名类型</div>
												<div class="input-box w65">
													<select name="is_loan" id="sell_type" class="sellCountjs">
														<option value="1">非抵押</option>
														<option value="2">抵押中</option>
													</select>
												</div>
												<div class="input-name-even w40" id="sell_loan_notice" style="display: none;"></div>
												<div class="clr"></div>
											</div>

											<div class="form-row form-row-s">
												<div class="input-name w25">抵押产品</div>
												<div class="input-box w65">
													<select name="cred_code" id="sellcreditflow" disabled="true">
													</select>
												</div>
												<div class="input-name-even w40" id="sell_dsloan_notice" style="display: none;"></div>
												<div class="clr"></div>
											</div>

											<div class="form-row form-row-s">
												<div class="input-name w25">抵押详情</div>
												<div class="input-box w65">
													<input type="text" class="input-s" name="descricred" data-type="s" placeholder="" id="descricredit" disabled="true" />
												</div>
												<div class="input-name-even w50" id="sell_dsldsdoan_notice" style="display: none;"></div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">卖出单价</div>
												<div class="input-box w20">
													<input type="tel" class="input-s" data-type="s" name="price" maxlength="7" id="sell_price" placeholder="单价(元)" valid="{'required':true, 'number': true, 'gt': '9000.0'}" msg="{'required':'请填写卖出单价', 'number':'卖出单价必须为数字', 'gt': '卖出单价不能小于9000.0'}">
												</div>
												<div class="input-name-even w50" id="sell_currency_formatter"></div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<div class="input-name w25">卖出数量</div>
												<div class="input-box w20">
													<input type="tel" class="input-s" name="number" maxlength="3" data-type="s" id="sell_number" placeholder="数量(个)" />
												</div>
												<div class="input-name-even w55" id="availableCount" data-availablecount="">可售数量:{$sellCount}个</div>
												<input type="hidden" value="" id="availableCount_hidden">
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">

												<div class="input-name w25">有效时间</div>
												<div class="input-box w65">
													<select name="duration">
														<option value="0">一直有效</option>
														<option value="1">1天</option>
														<option value="3">3天</option>
														<option value="5">5天</option>
														<option value="10">10天</option>
													</select>
												</div>
												<div class="clr"></div>
											</div>
											<div class="form-row form-row-s">
												<input type="hidden" id="commission" value="">
												<div class="input-name w25">合计总价</div>
												<div class="input-box w70" id="sell_total">
													0元(零元) <span class="red06 f12" id="commission_result">成交手续费({$rate}%)</span>
												</div>
												<div class="clr"></div>
											</div>
											<div class="split-dot text-center"></div>
											<div class="form-row form-row-s">
												<div class="input-name w25">交易密码</div>
												<div class="input-box w40">
													<input name="authpwd" type="password" valid="{'required':true}" msg="{'required':'请填写交易密码'}" class="input-s" autocomplete="off" id="sellpassid">
												</div>
												<div class="input-name-even w30">
													<a href="/Home/Center/pwd.html">设置密码?</a>
												</div>
												<div class="clr"></div>
											</div>
											<div class="split-dot mb20 text-center"></div>
											<div class="form-row form-row-s">
												<input type="button" action="confirm_selling" class=" button button-blue w100 " value="卖出">
												<div class="clr"></div>
											</div>
										</div>
									</form>
									<input type="hidden" value="1" id="tranTypdd" />
								</div>
							</div>
						</div>
						<div class="clr"></div>
					</div>
					<div class="table-wrapper">
						<h3>我的委托</h3>
						<div class="table-wrappper">
							<div class="table table-w200" id="agency_container">
								<div class="th">
									<div class="td w15"><span class="ml10">域名品种</span></div>
									<div class="td w15"><span class="ml10">委托时间</span></div>
									<div class="td w10"><span class="ml10">有效时间</span></div>
									<div class="td w10"><span class="ml10">交易类型</span></div>
									<div class="td w10"><span class="ml10">单价</span></div>
									<div class="td w10"><span class="ml10">总数量</span></div>
									<div class="td w10"><span class="ml10">剩余</span></div>
									<div class="td w5"><span class="ml10">操作</span></div>
									<div class="clr"></div>
								</div>
								<if condition="$count neq 0">
									<volist name="list" id="vo">
										<div class="tr domain" id="trdomain{$vo.id}">
											<div class="td w15"><span class="ml10">{$vo.domainType.name}</span></div>
											<div class="td w15"><span class="ml10">{$vo.createdate|strtotime|date="Y-m-d",###}</span></div>
											<div class="td w10"><span class="ml10">{$vo.expire_date|strtotime|date="Y-m-d",###}</span></div>
											<div class="td w10">
												<span class="ml10">
                                          <if condition="$vo.trans_type eq 1">
                                            买入
                                          <elseif condition="$vo.trans_type eq 2"/> 
                                                卖出
                                          </if>           
                                    </span>
											</div>
											<div class="td w10"><span class="ml10">{$vo.unit_price}</span></div>
											<div class="td w10"><span class="ml10">{$vo.dnumber}</span></div>
											<div class="td w10"><span class="ml10">{$vo.surplus}</span></div>
											<div class="td w5">
												<if condition="$vo.status eq 0 ">
													<a class="button-s button-blue" action="cancel_orderdd" data-id="{$vo.id}">
														撤&nbsp;&nbsp;单
													</a>
												</if>
											</div>
											<div class="clr"></div>
										</div>
									</volist>
									<else/>
									<div class="empty" style="height:100px;"></div>
								</if>
							</div>
						</div>
					</div>
				</div>
				<div class="clr"></div>
			</div>
		</div>

		<div popup="confirm" class="reveal-modal medium" topmeasure="50" topoffset="256" locked="false" animation="none" animationspeed="500" closeonbackgroundclick="true" dismissmodalclass="close-reveal-modal" dismissjqobject="[action=&quot;cancel&quot;]" z-index="1001" switch="open" style="z-index: 1002; display: none; top: 650px;">
			<a class="close-reveal-modal" action="closeModal">×</a>
			<div class="confirm-inner">
				<img src="{$app_path}{$static_path}/img/icon_orange_question.png">
				<span action="msg"></span>
			</div>

			<div class="split-dot mb20 text-center"></div>
			<div class="form-row">
				<a action="confirm" class=" button button-orange w40 fl">知道了</a>
				<a action="cancel" class=" button button-gray w40 fr">取消</a>
				<div class="clr"></div>
			</div>
		</div>
		<div class="reveal-modal-bg" style="display: none;"></div>
		<include file="./Public/public/footer.html" />
		<script type="text/javascript">
			var yaxis_datastr = "{$priceLogArr}";
			var xaxis_datastr = "{$dateLogArr}";
			var catename = "{$categoryobj['name']}";
			var tmp_data;
			$.ajax({
				type: "get",
				url: "{:U('Index/monthtralog',array('category'=>$categoryId))}",
				async: false,
				dataType: 'json',
				error: function(request) {},
				success: function(data) {
					tmp_data = data.monthlist;
				}
			});
			$(".sellCountjs").change(function() {
				if($(this).val() == 2) {
					$("#sellcreditflow").removeAttr("disabled");
					$("#sell_number").attr("disabled", "disabled");
					var catid = "{$categoryId}";
					$.ajax({
						type: "get",
						url: "{:U('Index/sellcount')}",
						data: {
							'cateid': catid
						},
						async: false,
						dataType: 'json',
						error: function(request) {},
						success: function(data) {
							var sellcreditflow = "<option value=''>-请选择-</option>";
							if(data.data != '') {
								$.each(data.data, function(n, value) {
									sellcreditflow += "<option value=" + value.flowid + ">" + value.count + "个-{$categoryobj['name']}" + "-授信额度￥" + value.credit + "</option>";
								});
								$("#sellcreditflow").html(sellcreditflow);
							}
						}
					});
				} else {
					$("#sell_currency_formatter").text("");
					$("#sellcreditflow").attr("disabled", "disabled");
					$("#sell_number").removeAttr("disabled");
				}
			});

			$("#sellcreditflow").change(function() {
				if($(this).val() == '') {
					return false;
				}
				$.ajax({
					type: "get",
					url: "{:U('Index/credtdetail')}",
					data: {
						'flowid': $(this).val()
					},
					async: false,
					dataType: 'json',
					error: function(request) {},
					success: function(data) {
						if(data.data != '') {
							$("#descricredit").val(data.data);
							$("#sell_currency_formatter").css("color", 'red').text("卖出总额需大于￥" + data.sellmoney);
						}
					}
				});
			});

			$("#buy_type").click(function() {
				if($(this).val() == 2) {
					$("#diya-term_period").removeAttr("disabled");
					$("#buy_type_period").removeAttr("disabled");
				} else {
					$("#diya-term_period").attr("disabled", "disabled");
					$("#buy_type_period").attr("disabled", "disabled");
				}
			});

			$("#diya-term_period").change(function() {
				var cateid = "{$categoryId}";
				$.ajax({
					type: "get",
					url: "{:U('Index/buycredits')}",
					data: {
						'category': cateid,
						'term': $(this).val()
					},
					async: false,
					dataType: 'json',
					error: function(request) {},
					success: function(data) {
						var buytypecredhtml = "";
						$.each(data.list, function(n, value) {
							buytypecredhtml += "<option value=" + value.id + " data-id=" + value.credit + ">年利率" + value.rate + "%/授信￥" + value.credit + "/可借￥" + value.creditmoney + "</option>";
						});
						$("#buy_type_period").html(buytypecredhtml);
					}
				});
				$("#buy_type_period").removeAttr("disabled");
			});
		</script>
		<script type="text/javascript" src="{$app_path}{$static_path}/js/tradehall.js"></script>
	</body>

</html>